import request from '@/utils/request'

// 查询盘点列表
export function listCheck(query) {
  return request({
    url: '/reserve/check/list',
    method: 'post',
    data: JSON.parse(JSON.stringify(query))
  })
}


// 查询盘点明细详细
export function getDetail(query) {
  return request({
    url: '/reserve/check/queryDetail',
    method: 'post',
    data: JSON.parse(JSON.stringify(query))
  })
}
// 查询仓库列表详细
export function getWareHouse() {
  return request({
    url: '/reserve/WareHouseAll',
    method: 'get',
  })
}
// 查询审批人列表详细
export function getApprover() {
  return request({
    url: '/reserve/approverAll',
    method: 'get',
  })
}
//获取最大id
export function getMaxID() {
  return request({
    url: '/reserve/maxID',
    method: 'get',
  })
}
//根据ID获取盘点单
export function getCheck(id) {
  return request({
    url: '/reserve/check/ById/'+id,
    method: 'get',
  })
}
//根据ID获取盘点单
export function getDetailById(id) {
  return request({
    url: '/reserve/detail/ById/'+id,
    method: 'get',
  })
}

// 新增盘点明细单
export function addDetail(data) {
  return request({
    url: '/reserve/addDetail',
    method: 'post',
    data: JSON.parse(JSON.stringify(data))
  })
}

// 新增盘点单
export function addCheck(data) {
  return request({
    url: '/reserve/addCheck',
    method: 'post',
    data: JSON.parse(JSON.stringify(data))
  })
}

// 修改盘点明细单
export function molDetail(data) {
  return request({
    url: '/reserve/updateDetail',
    method: 'put',
    data: JSON.parse(JSON.stringify(data))
  })
}

// 修改盘点单
export function molCheck(data) {
  return request({
    url: '/reserve/updateCheck',
    method: 'put',
    data: JSON.parse(JSON.stringify(data))
  })
}

// 删除盘点单
export function delCheck(id) {
  return request({
    url: '/reserve/check/delCheck/' + id,
    method: 'delete'
  })
}
// 删除盘点明细单
export function delDetail(id) {
  return request({
    url: '/reserve/check/delDetail/' + id,
    method: 'delete'
  })
}
// 批量删除盘点明细单
export function delDetailByInventory(id) {
  return request({
    url: '/reserve/check/delDetailByInventory/' + id,
    method: 'delete'
  })
}